package com.xz.demo1.factory;

import com.xz.demo1.domain.ConcreteProcuctA;
import com.xz.demo1.domain.ConcreteProcuctB;
import com.xz.demo1.domain.Product;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     Factory   
 * @package    com.xz.demo1.factory  
 * @date   2019/11/24 17:18  
 * @explain
 */
public class Factory {

    // 静态工厂方法
    public static Product getProduct(String arg){
        Product product = null;

        if ("A".equalsIgnoreCase(arg))
            product = new ConcreteProcuctA();
            // todo 初始化设置product属性
        else if ("B".equalsIgnoreCase(arg))
            product = new ConcreteProcuctB();
             // todo 初始化设置product属性
        return product;
    }
}
